import org.junit.Test

class SearchSortNum {
    fun searchSortNum(nums1: IntArray, nums2: IntArray): Double {
        val nums = nums1 + nums2
        nums.sort()
        return if (nums.size % 2 == 0) {
            (nums[nums.size / 2 - 1] + nums[nums.size / 2]) / 2.0
        } else {
            nums[nums.size / 2].toDouble()
        }
    }

    @Test
    fun test0() {
        assert(2.0 == searchSortNum(intArrayOf(1, 3), intArrayOf(2)))
    }

    @Test
    fun test1() {
        assert(2.5 == searchSortNum(intArrayOf(1, 2), intArrayOf(3, 4)))
    }
}